package com._23DesignPattern._create.Factory.SimpleFactory;

/**
 * @Author: huangya
 * @Date: 2019/1/6
 * @Description:
 */
public class SimpleFactoryTest {

    public static void main(String[] args) {

        /***************** SenderFactory1 简单工厂模式（01：普通工厂方法模式） start *****************/
        //MailSender send()..
        SenderFactory1 senderFactory1 = new SenderFactory1();
        Sender mailSender = senderFactory1.produce("mail");
        mailSender.send();

        //MessageSender send()..
        Sender messageSender = senderFactory1.produce("message");
        messageSender.send();
        /***************** SenderFactory1 简单工厂模式（01：普通工厂方法模式） end *****************/


        /***************** SenderFactory2 简单工厂模式（02：工厂方法模式） start *****************/
        //MailSender send()..
        SenderFactory2 senderFactory2 = new SenderFactory2();
        MailSender mailSender2 = senderFactory2.mailSenderProduce();
        mailSender2.send();

        //MessageSender send()..
        MessageSender messageSender2 = senderFactory2.messageSenderProduce();
        messageSender2.send();
        /***************** SenderFactory2 简单工厂模式（02：工厂方法模式） end *****************/

        /***************** SenderFactory3 简单工厂模式（02：静态工厂方法模式） start *****************/
        //MailSender send()..
        MailSender mailSender3 = SenderFactory3.mailSenderProduce();
        mailSender3.send();

        //MessageSender send()..
        MessageSender messageSender3 = SenderFactory3.messageSenderProduce();
        messageSender3.send();
        /***************** SenderFactory2 简单工厂模式（02：静态工厂方法模式） end *****************/
    }
}
